import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        //key为每个位置的瓶子个数，value为瓶子的位置
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(scanner.nextInt(), i + 1);
        }
        int q = scanner.nextInt();
        while (q > 0) {
            q--;
            int m = scanner.nextInt();
            if (map.containsKey(m)) {
                System.out.println(map.get(m));
            } else {
                System.out.println(0);
            }
        }
        scanner.close();
    }
}
